package cn.bsuc.crm.config;

import cn.bsuc.crm.interceptor.DoThreadLocalInterceptor;
import cn.bsuc.crm.interceptor.LoginInterceptor;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author : zhuoyuan
 * @date : 2022/10/8 20:03
 * @description :
 */
//@Configuration
public class SpringMvcConfig implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor  loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/user/login","/captchaImage")
                .order(1);
        registry.addInterceptor(new DoThreadLocalInterceptor())
                .order(0);
    }
}
